#include <iostream>
#include <string.h>
#include <sstream>

using namespace std;

int rmd[3000];
int n, m;

int main()
{
	int ntest = 0;
	while (cin >> n >> m)
	{
		stringstream ss;
		ss << n << "/" << m << " = " << n/m << ".";

		memset(rmd, 0xFF, sizeof(rmd));
		
		int r = n%m;
		rmd[r] = 0;
		int count = 1;

		while (true)
		{
			while (r < m)
			{
				r *= 10;
				if (r < m)
				{
					ss << 0;
			
					if (rmd[r] != -1)
					{
						string s = ss.str();
						int pos = s.find('.')+1; 
						s.insert(pos+rmd[r], "(");
						if (s.size()-1 - (pos + rmd[r]) > 50)
						{
							while (s.size()-1 - (pos + rmd[r]) > 50) s.erase(s.size()-1);
							s += "...";
						}
						s += ")";
						cout << s << endl;
						cout << "   " << count - rmd[r] << " = number of digits in repeating cycle" << endl;
						goto label;
					}

					rmd[r] = count++;
				}

				if (r == 0) break;
			}
			ss << r/m;
			r %= m;
			
			if (rmd[r] != -1)
			{
				string s = ss.str();
				int pos = s.find('.')+1; 
				s.insert(pos+rmd[r], "(");
				if (s.size()-1 - (pos + rmd[r]) > 50)
				{
					while (s.size()-1 - (pos + rmd[r]) > 50) s.erase(s.size()-1);
					s += "...";
				}
				s += ")";
				cout << s << endl;
				cout << "   " << count - rmd[r] << " = number of digits in repeating cycle" << endl;
				break;
			}

			rmd[r] = count++;
		}

		label: {
		
		}
		cout << endl;
	}
	return 0;
}
